package com.eureka.server.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.netflix.eureka.server.event.EurekaInstanceCanceledEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Configuration;

/**
 * 服务下线事件
 *
 * @Author yin_q
 * @Date 2019/8/28 11:47
 * @Email yin_qingqin@163.com
 **/
@Configuration
@Slf4j
public class InstanceCancelListener implements ApplicationListener<EurekaInstanceCanceledEvent> {

    @Override
    public void onApplicationEvent(EurekaInstanceCanceledEvent event) {
        log.info("服务：{}挂了, servcerId {}", event.getAppName(), event.getServerId());
    }
}
